// const { SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION } = require("constants");

function huitian() {
    var form = layui.form;
// -----------------数据回填--------------
$.ajax({
    url: '/my/user/userinfo',
    success: function (res) {
        console.log(res);
        if (res.status === 0) {
            form.val('user',res.data)
        }
    }
})

}
huitian();

$('form').on('click',function (e) {
    e.preventDefault();
    var data = $(this).serialize();

    $.ajax({
        url: '/my/user/userinfo',
        type: 'POST',
        data: data,
        success: function (res) {
            layer.msg(res.message);

            if(res.status === 0) {
                window.parent.getUserInfo();
            }
        }
    })
})

// 点击重置，恢复原样
$('button[type=reset]').on('click',function (e) {
    e.preventDefault();
    huitian();
})